package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
/*        	 config.addAnnotatedClass(Entidades.Central.class);
        	 config.addAnnotatedClass(Entidades.Empleado.class);
        	 config.addAnnotatedClass(Entidades.PlanProduccion.class);
        	 config.addAnnotatedClass(Entidades.Proveedor.class);
        	 config.addAnnotatedClass(Entidades.Rol.class);*/
        	 config.addAnnotatedClass(Entidades.Sucursal.class);
        	 
        	 
			 config.buildSettings();
			 sessionFactory = config.buildSessionFactory();
			 sessionFactory.openSession();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
